package li.nibble.twittertido;

import li.nibble.twittertido.lazyimage.ImageLoader;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.widget.Toast;

public class MainPreferences extends PreferenceActivity {
	/** Called when the activity is first created. */

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		addPreferencesFromResource(R.xml.main_preferences);

		Preference myPref = (Preference) findPreference("clear_chache");
		myPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
			public boolean onPreferenceClick(Preference preference) {
				ImageLoader il = new ImageLoader(MainPreferences.this);
				il.clearCache();
				Toast.makeText(MainPreferences.this,
						"La caché de imágenes ha sido borradas",
						Toast.LENGTH_SHORT).show();
				return true;
			}
		});
	}

}
